<%@ page language="java" import="java.util.*" pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
<%@include file="/inc/taglibs.jsp" %>
<style>
</style>
<script>
function save(form){
	//验证
	var title=$("#title").val();
	if(title==null || title=="")
	{
		showTip("标题不能为空！",null,1);
		return false;
	}
	var url=$("#url").val();
	if(url==null || url=="")
	{
		showTip("网址不能为空！",null,1);
		return false;
	}
	var keyword1=$("#keyword1").val();
	var keyword2=$("#keyword2").val();
	var keyword3=$("#keyword3").val();
	var keyword4=$("#keyword4").val();
	var keyword5=$("#keyword5").val();
	var keyword6=$("#keyword6").val();
	var keyword7=$("#keyword7").val();
	var keyword8=$("#keyword8").val();
	if(
		keyword1==null || keyword1==""
		|| keyword2==null || keyword2==""
		|| keyword3==null || keyword3==""
		|| keyword4==null || keyword4==""
		|| keyword5==null || keyword5==""
		|| keyword6==null || keyword6==""
		|| keyword7==null || keyword7==""
		|| keyword8==null || keyword8==""
		)
	{
		showTip("关键字不能为空！",null,1);
		return false;
	}
	$("#keyword").val(
						 keyword1+" "+keyword2+" "+keyword3+" "+keyword4+" "
						+keyword5+" "+keyword6+" "+keyword7+" "+keyword8
					);
	ajaxSubmit(form,function(msg){
		alert(msg.msg);
	});
	return false;
}
</script>
<div>
<form action="${path }/website/save" onsubmit="return save(this);">
<div id="form_div">
<input type="hidden" name="userid" value="${website.userid}">
<input type="hidden" name="keyword"  id="keyword"  value="${website.keyword}">
<input type="hidden" name="id" value="${website.id}">
	<ul>
		<li><div class="fieldtitle">标题:</div><div class="field"><input type="text" name="title" id="title" value="${website.title}"></div><div class="fieldmsg">填写网址标题</div></li>
		<li><div class="fieldtitle">网址:</div><div class="field"><input type="text" name="url" id="url" value="${website.url}"></div><div class="fieldmsg">填写网址URL</div></li>
		<li>
			<div class="fieldtitle">关键字:</div>
			<div class="field">
				<input type="text" style="width:60px;" value="${keyword1}" name="keyword1" id="keyword1">
				<input type="text" style="width:60px;" value="${keyword2}" name="keyword2" id="keyword2">
				<input type="text" style="width:60px;" value="${keyword3}" name="keyword3" id="keyword3">
				<input type="text" style="width:60px;" value="${keyword4}" name="keyword4" id="keyword4">
				<input type="text" style="width:60px;" value="${keyword5}" name="keyword5" id="keyword5">
				<input type="text" style="width:60px;" value="${keyword6}" name="keyword6" id="keyword6">
				<input type="text" style="width:60px;" value="${keyword7}" name="keyword7" id="keyword7">
				<input type="text" style="width:60px;" value="${keyword8}" name="keyword8" id="keyword8">
			</div>
			<div class="fieldmsg">请输入8个关键字</div>
		</li>		
	</ul>
	<ul>
		<li>
		<div class="field">
			<button type="submit">&nbsp;保存&nbsp;</button>
			<button type="button" onclick="urlParameterGoPage('/website/list','已添加监控网址')">&nbsp;返回&nbsp;</button>
		</div>
		</li>
	</ul>
</div>
</form>
</div>
<script>
	var keyword=$("#keyword").val();
	if(keyword!=null && keyword!="")
	{
		var kws = keyword.split(" ");
		for(var i=0;i<8;i++)
		{
			var no=i+1;
			$("#keyword"+no).val(kws[i]);
		}
	}
</script>